package com.kuang.demo.service;

import com.kuang.demo.mapper.RegionMapper;
import com.kuang.demo.service.RegionService;
import com.kuang.demo.vo.RegionVO;
import com.kuang.demo.vo.wx.WxQueryRegionListByIdVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 郭浩 on 2020/11/3 14:32
 */
@Service
public class RegionServiceImpl implements RegionService {

    @Autowired
    RegionMapper regionMapper;

    @Override
    public List<RegionVO> regionList() {

        return regionMapper.queryRegionList();
    }

    @Override
    public String getDetailAddress(Integer provinceId, Integer cityId, Integer areaId) {
        String province = regionMapper.queryNameById(provinceId);
        String city = regionMapper.queryNameById(cityId);
        String area = regionMapper.queryNameById(areaId);
        return province+city+area;
    }

    @Override
    public List<WxQueryRegionListByIdVO> getListByPid(int pid) {
        List<WxQueryRegionListByIdVO> wxQueryRegionListByIdVOList = regionMapper.getListByPid(pid);
        return wxQueryRegionListByIdVOList;
    }
}
